package org.zxp.designpattern.singleton.practise;

/**
 * @program: effectiveJava
 * @description:
 * @author: X-Pacific zhang
 * @create: 2019-11-27 09:42
 **/
public enum EnumClass {
    INSTANCE;

    private Object o1;

    EnumClass(){
        o1 = new Object();
    }

    public static EnumClass getInstance(){
        return INSTANCE;
    }

    public void print(){
        System.out.println(o1.hashCode());
    }
}
class Test{
    public static void main(String[] args){
        EnumClass enumClass1 = EnumClass.getInstance();
        EnumClass enumClass2 = EnumClass.getInstance();
        enumClass1.print();
        enumClass2.print();

    }
}
